-
Notifications
You must be signed in to change notification settings - Fork 65
feat: Add toolbar input select #1260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/toolbar-epic
Are you sure you want to change the base?
Conversation
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
…slib into feat/toolbar-container
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
…slib into feat/toolbar-container
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
| flex-direction: row; | ||
| align-items: center; | ||
| align-self: stretch; | ||
| min-height: 2.5rem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only to match what we currently have in the buttons PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: this includes both min-height and padding-block
| .bslib-toolbar { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with these changes to toolbar.scss for the .bslib-toolbar (Also just to match what's in buttons)
| select { | ||
| appearance: auto; | ||
| padding-block: 3px; // Decreased to slim down select to fit in header | ||
| /* .form-controls takes away the drop-down arrow, this ensures it shows up */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I understand what this comment is saying, but I'm not sure. Some things to clarify:
- Which
.form-controls? Do you mean Bootstrap's rule, Shiny's rule, or another rule in bslib? - I'm pretty sure
itrefers to the drop-down arrow, but I'm not sure whatthisrefers to. I think you could probably re-order this sentence a bit to avoid two adjacent implicit references.
| #' @param choices List of values to select from. If elements of the list are | ||
| #' named, then that name - rather than the value - is displayed to the user. | ||
| #' It's also possible to group related inputs by providing a named list whose | ||
| #' elements are (either named or unnamed) lists, vectors, or factors. In this | ||
| #' case, the outermost names will be used as the group labels (leveraging the | ||
| #' `<optgroup>` HTML tag) for the elements in the respective sublist. | ||
| #' @param selected The initially selected value. If not specified then defaults | ||
| #' to the first value. | ||
| #' @param width The width of the input, e.g. '400px', or '100%'; see | ||
| #' [validateCssUnit()]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably sufficient; it looks like this documentation was copied from selectInput() anyway.
| #' @param choices List of values to select from. If elements of the list are | |
| #' named, then that name - rather than the value - is displayed to the user. | |
| #' It's also possible to group related inputs by providing a named list whose | |
| #' elements are (either named or unnamed) lists, vectors, or factors. In this | |
| #' case, the outermost names will be used as the group labels (leveraging the | |
| #' `<optgroup>` HTML tag) for the elements in the respective sublist. | |
| #' @param selected The initially selected value. If not specified then defaults | |
| #' to the first value. | |
| #' @param width The width of the input, e.g. '400px', or '100%'; see | |
| #' [validateCssUnit()]. | |
| #' @inheritParams shiny::selectInput |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to keep documentation local to toolbar_input_select() -- width might be one case -- you can keep the @param docs here.
| class = "bslib-toolbar-input-select form-select-sm", | ||
| shiny::selectInput( | ||
| id, | ||
| label = NULL, # Removed for slimline input component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably need to keep label but use it for accessibility markup
| width = NULL | ||
| ) { | ||
| htmltools::div( | ||
| class = "bslib-toolbar-input-select form-select-sm", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might want to allow ..., check that they're all named arguments (i.e. they are all attributes), and then let people add attributes to the outer container.
| width = NULL | |
| ) { | |
| htmltools::div( | |
| class = "bslib-toolbar-input-select form-select-sm", | |
| width = NULL, | |
| ... | |
| ) { | |
| rlang::check_dots_named() | |
| htmltools::div( | |
| class = "bslib-toolbar-input-select form-select-sm", | |
| ..., |
| selected = selected, | ||
| multiple = FALSE, | ||
| selectize = FALSE, | ||
| width = width |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size = NULL is the default for selectInput() and usually I wouldn't include it here, but if it's set you get a very different select input so it's worth setting this to ensure it doesn't accidentally change on us later.
| width = width | |
| width = width, | |
| size = NULL |

Fixes #1249
Toolbar Input Selects should: